//
//  SNHViewController.m
//  SNHActionSheetKit
//
//  Created by chenjianlei on 06/01/2018.
//  Copyright (c) 2018 chenjianlei. All rights reserved.
//

#import "SNHViewController.h"
#import "SNHBottomActionSheet.h"
#import "SNHTopActionSheet.h"
#import "SNHCenterActionSheet.h"
#import <SNHActionSheetKit/SNHActionSheetKit.h>

@interface SNHViewController ()
@property (nonatomic, strong) UIView *bgView;
@end

@implementation SNHViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
//    self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 350, 375, self.view.frame.size.height - 400)];
//    self.bgView.backgroundColor = [UIColor redColor];
//    [self.view addSubview:self.bgView];
}

#pragma mark - Action
- (IBAction)onActionTop:(id)sender {
    SNHTopActionSheet *actionSheet = [SNHTopActionSheet actionSheetWithHeight:100];
//    [actionSheet showInSuperView:self.bgView];
    [actionSheet showInWindow];
}

- (IBAction)onActionBottom:(id)sender {
    SNHBottomActionSheet *actionSheet = [SNHBottomActionSheet actionSheetWithHeight:200];
//    actionSheet.isTapMiss = NO;
    [actionSheet showInWindow];
//    [actionSheet showInSuperView:self.bgView];
}

- (IBAction)onActionCenter:(id)sender {
#if 0
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"test" message:@"this is test" preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
    [self presentViewController:alert animated:YES completion:nil];
#else
    SNHCenterActionSheet *actionSheet = [SNHCenterActionSheet actionSheetWithSize:CGSizeMake(100, 100)];
//    [actionSheet showInWindow];
    [actionSheet showInSuperView:self.bgView];
#endif
}

- (IBAction)onActionFail:(id)sender {
    [SNHFeedbackGenerator error];
}

- (IBAction)onActionWaring:(id)sender {
    [SNHFeedbackGenerator warning];
}

- (IBAction)onActionSuccess:(id)sender {
    [SNHFeedbackGenerator success];
}

- (IBAction)onActionSelection:(id)sender {
    [SNHFeedbackGenerator selection];
}

- (IBAction)onActionHeavy:(id)sender {
    [SNHFeedbackGenerator heavy];
}

- (IBAction)onActionMedium:(id)sender {
    [SNHFeedbackGenerator medium];
}

- (IBAction)onActionLight:(id)sender {
    [SNHFeedbackGenerator light];
}

@end
